package com.wang.designpattern.factory.absfactory.store;

import com.wang.designpattern.factory.absfactory.pizza.Pizza;
import com.wang.designpattern.factory.absfactory.tea.Tea;

public class PizzaStore {

    public static void main(String[] args) {
        OrderPizza orderPizza = new OrderPizza();

        AbsFactory factory = new BJFactory();
        orderPizza.setPizzaFactory(factory);

        Pizza pizza = orderPizza.orderPizza();
        Tea tea = orderPizza.getTea();
        if (null != tea) {
            tea.makeTea();
        }
        if (null != pizza) {
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }

        System.out.println("***********************************");

        factory = new LDFactory();
        orderPizza.setPizzaFactory(factory);

        pizza = orderPizza.orderPizza();
        tea = orderPizza.getTea();
        if (null != tea) {
            tea.makeTea();
        }
        if (null != pizza) {
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }
    }

}
